package com.hoopchina.ui.search;


import com.hoopchina.news.R;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.Button;

/**
 * SearchRecordListButtonItem
 * 搜索历史列表的clearbutton item
 * 
 * @author Guo Baiyu
 */
public class SearchRecordListButtonItem extends TextListItem {
    @SuppressWarnings ( "unused" )
    private Context mContext     = null;
    private Button  mClearButton = null;

    /**
     * 
     * @param context
     * @param attrs
     */
    public SearchRecordListButtonItem( Context context, AttributeSet attrs ) {
        super( context, attrs );
        init( context );
    }

    /**
     * 
     * @param context
     */
    public SearchRecordListButtonItem( Context context ) {
        super( context );
        init( context );
    }

    /**
     * 
     * @param context
     */
    private void init( Context context ) {
        mContext = context;

        String infServiString = Context.LAYOUT_INFLATER_SERVICE;
        LayoutInflater lInflater;
        lInflater = ( LayoutInflater ) getContext().getSystemService( infServiString );
        lInflater.inflate( R.layout.searchrecordlistbuttonitem, this, true );

        mClearButton = ( Button ) findViewById( R.id.buttonSearchRecordListClearButtonItem );
    }

    /**
     * 
     * @param listener
     */
    void setClearButtonOnClickListener( OnClickListener listener ) {
        mClearButton.setOnClickListener( listener );
    }
}
